package org.veloxbot.api.internals;

import org.veloxbot.api.listeners.PaintListener;

import java.util.List;
import java.util.ArrayList;

/**
 * @author Velox
 */
public class PaintComposite {

	private static List<PaintListener> listeners = new ArrayList<PaintListener>();

	/**
	 * Gets the submitted PaintListeners.
	 *
	 * @return An array of submitted PaintListeners.
	 */
	public static PaintListener[] getPaintListeners() {
		return listeners.toArray(new PaintListener[listeners.size()]);
	}

	/**
	 * Adds the given PaintListener to a list.
	 *
	 * @param listener The PaintListener to submit.
	 */
	public static void submit(final PaintListener listener) {
		listeners.add(listener);
	}

	/**
	 * Removes the given PaintListener from the list of submitted PaintListeners.
	 *
	 * @param listener The PaintListener to remove from the list of submitted PaintListeners.
	 */
	public static void revoke(final PaintListener listener) {
		listeners.remove(listener);
	}
}
